package com.chenchao.javaprocesscontrol;

/**
 * @encoding : UTF-8
 * @Time : 2020/11/7 9:38
 * @Author : Chen Chao
 * @File : javaSE.com.chenchao.javaprocesscontrol.JavaStructure.java
 * @Software : IntelliJ IDEA
 * @since : 1.8
 */
public class JavaStructure {
    public static void main(String[] args) {
        JavaStructure.printTriangle(6);
    }

    /**
     * printTriangle 打印n行三角形
     *
     * @param row 三角形的行数
     */
    public static void printTriangle(int row) {
        for (int i = 0; i < row; i++) {
            for (int j = row - i - 1; j > 0; j--) {
                System.out.print(" ");
            }
            for (int j = 1; j < i + 1; j++) {
                System.out.print("*");
            }
            for (int j = 0; j < i + 1; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }
}
